alias

alias alias_name command

Description

Creates aliases to execute any ExtremeXOS command, including any options, arguments, and redirection.

Syntax Description

alias_name Specifies an alias name for the command.
command ExtremeXOS command that you are creating an alias for.

Default

N/A

Usage Guidelines

To be recognized, the alias must be the first word in the string typed at the shell prompt. Substitution does not occur if the alias name string occurs anywhere else. Aliases are only recognized by the EXSH shell session in which they are created.

Executing the command alias (with no other arguments) displays a list of current aliases. Executing the command alias alias_name displays the command that will be substituted for alias_name.

To delete aliases, use the command unalias.

After an alias has been created, you can auto-complete the alias name or display possible aliases along with regular commands by pressing the TAB key. You can tab-complete arguments that follow commands corresponding to an alias.

Creating an alias using the name of an existing ExtremeXOS command overrides the original meaning of that command. For example, executing alias download "download image 102.3.10.5" allows you to simply type download image_name to download your ExtremeXOS image from the 102.3.10.5 location . However, if you then want to download a bootrom file, the command download bootrom 102.3.10.5filename no longer functions correctly. Such an alias can be disabled temporarily and the original command behavior restored by preceding it directly (with no spaces in between) with a backslash, \download bootrom 102.3.10.5filename This temporarily overrides the alias definition and uses the original command.

To create an alias for a command that contains quoted strings within it, use a backslash. For example, if creating an alias "cr" for the command configure vlan default description "This is the default VLAN", use the command alias cr "configure vlan default description \"This is the default VLAN\"".

The following limitations apply to aliases:
  • Arguments cannot occur in the middle of alias commands. For example, you cannot create an alias "set_vlan_ip" for the command configure vlan vlan_name ipaddress ip_address where you specify the VLAN name as an argument. This is because aliases work through direct textual substitution.
  • Aliases cannot be chained together. For example, if you create an alias "sh" for show version and another alias "ps" for process, then entering sh ps at the prompt is not equivalent to entering “show version process”.
  • You cannot tab-complete commands while trying to create an alias using the alias command.
  • Aliases cannot be created for the current shell session using UPM scripts or Python scripts.

Aliases are only available in the shell session in which they are created. When you exit the shell your aliases are lost. To create persistent aliases, you need to add the aliases to the script exshrc.xsf that you must create using the VI editor and save in the /usr/local/cfg folder.

Example

The following example creates an alias named "set" for configure commands:

alias set "configure"

You can now substitute the command set for all configure commands. For example, you can type set vlan vlan_name tag tag instead of configure vlan vlan_name tag tag.

The following example creates an alias named "mycmd" to substitute for the configure policy profile command with the following arguments:
alias mycmd "configure policy profile 1 name Extreme pvid 1000 pvid-status enable tci-overwrite enable auth-override enable forbidden-vlans 2 cos-status enable cos 2 untagged-vlans 2 egress-vlans 200" 

Typing mycmd now executes the command configure policy profile 1 name Extreme pvid 1000 pvid-status enable tci-overwrite enable auth-override enable forbidden-vlans 2 cos-status enable cos 2 untagged-vlans 2 egress-vlans 200

The following example lists all current aliases:
alias
alias mycmd='configure policy profile 1 name Extreme pvid 1000 pvid-status enable tci-overwrite enable auth-override enable forbidden-vlans 2 cos-status enable cos 2 untagged-vlans 2 egress-vlans 200'
alias set='configure'

History

This command was first available in ExtremeXOS 22.3

Platform Availability

This command is available on all Universal switches supported in this document.